Skip to content

Conversation

@samLEDE
Copy link

@samLEDE samLEDE commented Oct 22, 2019

No description provided.

Copy link
Collaborator

@tawebbcn tawebbcn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you have time, try to do the first iterations again to get them right. If you need any help let us now and one of us will help you right away! :)


// Lorem ipsum generator
//Let's get looping
for (var i = 0; i < hacker1.length || hacker2.length; i++){
Copy link
Collaborator

@tawebbcn tawebbcn Oct 22, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The challenge here was to compare the length of two element. It would have been easier to just compare element1.length and element2.length with no need to use a for loop since you can get the length of a string directly with the ".length()" property. Then you only return the one that is longer (if element1.length < element2.length return element2)

}

//loops driver name backwards
for(let i = hacker.length; i > 0; i--){
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here for 'samuel' backwards you'd get 'amuel', missing the first letter. To reach the first letter you need to iterate backwards and set the condition of the for loop (the middle statement) to also equal 0, just like this:

for(let i = hacker.length; i >= 0; i--) You only forgot to add the equal symbol

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants